package com.wdh.kjs.Adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.wdh.kjs.R;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * Created by feifei on 2016/4/20.
 */

public class InvestmentDetailFourAdapter extends BaseAdapter {

    private List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
    private Context context;
    private HashMap<String, String> maps = new HashMap<String, String>();

    public InvestmentDetailFourAdapter(Context context, List<HashMap<String, String>> data) {
        this.data = data;
        this.context = context;
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return data.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder;

        if (convertView == null) {
            viewHolder = new ViewHolder();
            convertView = View.inflate(context, R.layout.item_investmentdetail_four, null);
            viewHolder.tv_item_id_four_phone = (TextView) convertView.findViewById(R.id.tv_item_id_four_phone);
            viewHolder.tv_item_id_four_money = (TextView) convertView.findViewById(R.id.tv_item_id_four_money);
            viewHolder.tv_item_id_four_time = (TextView) convertView.findViewById(R.id.tv_item_id_four_time);
           convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        maps = data.get(position);

        viewHolder.tv_item_id_four_phone.setText(maps.get("tv_item_id_four_phone"));
        viewHolder.tv_item_id_four_money.setText(maps.get("tv_item_id_four_money"));
        viewHolder.tv_item_id_four_time.setText(maps.get("tv_item_id_four_time"));


        return convertView;
    }

    class ViewHolder {
        TextView tv_item_id_four_phone;
        TextView tv_item_id_four_money;
        TextView tv_item_id_four_time;


    }
}